# cmake_minimum_required(VERSION 3.10)
# project(rabbitmq_example)

# set(CMAKE_CXX_STANDARD 11)

# # 查找 SimpleAmqpClient
# #find_package(SimpleAmqpClient REQUIRED)
# find_package(PkgConfig REQUIRED)
# pkg_check_modules(SIMPLEAMQPCLIENT REQUIRED libSimpleAmqpClient)


# # 创建可执行文件
# add_executable(publisher publisher.cpp)
# add_executable(consumer consumer.cpp)

# # 链接库
# target_link_libraries(publisher SimpleAmqpClient)
# target_link_libraries(consumer SimpleAmqpClient)


cmake_minimum_required(VERSION 3.10)
project(rabbitmq_example)

set(CMAKE_CXX_STANDARD 11)

# 查找 SimpleAmqpClient
find_package(PkgConfig REQUIRED)
pkg_check_modules(SIMPLEAMQPCLIENT REQUIRED libSimpleAmqpClient)

# 创建可执行文件
add_executable(publisher publisher.cpp)
add_executable(consumer consumer.cpp)

add_executable(pub pub.cpp)
add_executable(sub sub.cpp)

# 正确链接库和包含目录
target_include_directories(publisher PRIVATE ${SIMPLEAMQPCLIENT_INCLUDE_DIRS})
target_include_directories(consumer PRIVATE ${SIMPLEAMQPCLIENT_INCLUDE_DIRS})
target_link_libraries(publisher ${SIMPLEAMQPCLIENT_LIBRARIES})
target_link_libraries(consumer ${SIMPLEAMQPCLIENT_LIBRARIES})

target_link_libraries(pub ${SIMPLEAMQPCLIENT_LIBRARIES})
target_link_libraries(sub ${SIMPLEAMQPCLIENT_LIBRARIES})